package com.lagou.listener;

import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Component;

@Component
public class MyMessageListener {

    @KafkaListener(topics = "MyTopic")
    public void onMessage(ConsumerRecord<Integer, String> consumerRecord) {
        System.out.println("key:" + consumerRecord.key() + ",value:" + consumerRecord.value() + ",offset:" + consumerRecord.offset());
    }

}
